package variableparameter;

public class Demo3 {
    public static void main(String[] args) {

        int sum = getSum(1,3,5,7);
        System.out.println(sum);
    }
    public static  int getSum(int...arr){
        int sum =0;
/*        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }
        return sum;*/

        for (int i : arr) {
            sum+=i;
        }
        return sum;
    }
}
